import { createSSRApp } from 'vue'
import uviewPlus from 'uview-plus'
import router from './router'
import { createPinia } from 'pinia'
import { createUnistorage } from 'pinia-plugin-unistorage'
import App from './App.vue'

// 状态管理
const store = createPinia()
// 持久化
store.use(createUnistorage())

export function createApp() {
  const app = createSSRApp(App)
  app.use(router)

  // 使用 store 变量，而不是未定义的 pinia
  app.use(store)
  app.use(uviewPlus)
  return {
    app,
  }
}
